<template>
    <el-carousel :style="{ width: `${width}%` }" :interval="interval" arrow="never" indicator-position="none" direction="vertical" :pause-on-hover="false">
      <el-carousel-item
        class="department-section"
        v-for="(item, index) in sections"
        :key="index"
      >
        <div class="department-section-dept">{{ item.departName }}</div>
        <div class="department-section-data">
          <div
            v-for="(doctor, index) in item.employees"
            :key="index"
            class="department-section-data-item"
          >
            <DoctorCard
              :doctor="doctor"
              :index="index"
            />
          </div>
        </div>
      </el-carousel-item>
    </el-carousel>
  </template>
  
  <script setup>
  import DoctorCard from "./DoctorCard.vue";
  
  const props = defineProps({
    sections: {
      type: Array,
      required: true,
      default: () => [
        {
          departName: "",
          departId: "",
          employees: [],
        },
      ],
    },
    interval: {
      type: Number,
      default: 3000,
    },
    width: {
      type: Number,
      default: 100,
    },
  });
  </script>
  
  <style scoped lang="scss">
  .el-carousel {
    :deep(.el-carousel__container) {
      height: 100%;
    }
  }
  .department-section {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    padding: 0;
    color: #221c59;
    font-size: 0.3rem;
    min-width: 0;
    &-dept {
      flex: 0 0 0.8rem;
      background: #fff;
      border-radius: 0.08rem;
      margin: 0.05rem;
      font-size: 0.5rem;
      display: block;
      align-items: center;
      text-align: center;
      justify-content: center;
      padding: 0.05rem;
      overflow: hidden;
      font-weight: bold;
      writing-mode: vertical-lr;
      letter-spacing: 0.05rem;
    }
    &-data {
      flex: auto;
      min-width: 0;
      display: flex;
      flex-wrap: wrap;
      flex-direction: column;
      &-item {
        width: 4.08rem;
        height: 50%;
        margin: 0;
        padding: 0.05rem;
      }
    }
  }
  </style>
  